'use strict';

var moment = require('moment');

module.exports = app => {
  const {
    INTEGER,
    STRING,
    DATE
  } = app.Sequelize;

  const Config = app.model.define('configs', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    code: STRING,
    cityDesc: STRING,
    originName: STRING,
    destinationName: STRING,
    created_at: {
      type: DATE,
      get() {
        return moment(this.getDataValue('created_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    },
    updated_at: {
      type: DATE,
      get() {
        return moment(this.getDataValue('updated_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    },
  });

  Config.associate = function() {
    
  };

  return Config;
};